package jsyf.oa.web.report.information;

import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import jsyf.com.util.BaseUtils;
import jsyf.com.util.ResponseUtils;
import jsyf.oa.facade.report.information.PersonnelReportFacade;
import jsyf.oa.facade.report.mineCustomer.CustomerReportFacade;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * Created by Admin on 2018/4/5.
 */
@Api(value = "人员情况报表接口", description = "人员情况报表接口")
@Controller
@RequestMapping("/personnelReport")
public class PersonnelReportController {
    @Resource
    private PersonnelReportFacade personnelReportFacade;

//    @ResponseBody
//    @RequestMapping(value = "/getPersonnelList.json", method = RequestMethod.POST)
//    @ApiOperation(
//            value = "查询人员情况列表",
//            notes = "查询人员情况列表 ",
//            httpMethod = "POST",
//            produces = MediaType.APPLICATION_JSON_VALUE)
//    @ApiImplicitParam(name = "jsonData", value = "{userId:'',dateTime:''}", dataType = "String", paramType = "body")
//    public void getPersonnelList(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
//        List<JSONObject> records = this.personnelReportFacade.getPersonnelList(jsonData);
//        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(records));
//    }
//
//    @ResponseBody
//    @RequestMapping(value = "/getForDepartByUserId.json", method = RequestMethod.POST)
//    @ApiOperation(
//            value = "获取部门明细",
//            notes = "获取部门明细 ",
//            httpMethod = "POST",
//            produces = MediaType.APPLICATION_JSON_VALUE)
//    @ApiImplicitParam(name = "jsonData", value = "{userId:'201712162032474387FC7EAE66BEFF22'}", dataType = "String", paramType = "body")
//    public void getForDepartByUserId(HttpServletResponse response, @RequestBody String jsonData) {
//        List<JSONObject> records = this.personnelReportFacade.getForDepartByUserId(jsonData);
//        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(records));
//    }
//
//    @ResponseBody
//    @RequestMapping(value = "/getForDepartNumberByUserId.json", method = RequestMethod.POST)
//    @ApiOperation(
//            value = "获取部门明细",
//            notes = "获取部门明细 ",
//            httpMethod = "POST",
//            produces = MediaType.APPLICATION_JSON_VALUE)
//    @ApiImplicitParam(name = "jsonData", value = "{userId:'201712162032474387FC7EAE66BEFF22',dateTime:'2018-04-17'}", dataType = "String", paramType = "body")
//    public void getForDepartNumberByUserId(HttpServletResponse response, @RequestBody String jsonData) {
//        List<JSONObject> records = this.personnelReportFacade.getForDepartNumberByUserId(jsonData);
//        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(records));
//    }
//
//    @RequestMapping(value = "/getForDepartByDepartId.json", method = RequestMethod.POST)
//    @ApiOperation(
//            value = "获取部门明细",
//            notes = "获取部门明细",
//            httpMethod = "POST",
//            produces = MediaType.APPLICATION_JSON_VALUE)
//    @ApiImplicitParam(name = "jsonData",value = "{departId:'2017121617594DCC86E158E6249B66D2'}",dataType = "String", paramType = "body")
//    public void getForDepartByDepartId(HttpServletResponse response, @RequestBody String jsonData) {
//        List<JSONObject> jsonObjectList = this.personnelReportFacade.getForDepartByDepartId(jsonData);
//        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(jsonObjectList));
//    }
//

//
//    @RequestMapping(value = "/getForCompanyByCompanyId.json", method = RequestMethod.POST)
//    @ApiOperation(
//            value = "获取公司明细",
//            notes = "获取公司明细",
//            httpMethod = "POST",
//            produces = MediaType.APPLICATION_JSON_VALUE)
//    @ApiImplicitParam(name = "jsonData",value = "{companyId:'2017121617474C0586950A72B2629E79'}",dataType = "String", paramType = "body")
//    public void getForCompanyByCompanyId(HttpServletResponse response, @RequestBody String jsonData) {
//        List<JSONObject> jsonObjectList = this.personnelReportFacade.getForCompanyByCompanyId(jsonData);
//        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(jsonObjectList));
//    }
//
//    @RequestMapping(value = "/getForGroupByUserId.json", method = RequestMethod.POST)
//    @ApiOperation(
//            value = "获取集团明细",
//            notes = "获取集团明细",
//            httpMethod = "POST",
//            produces = MediaType.APPLICATION_JSON_VALUE)
//    @ApiImplicitParam(name = "jsonData",value = "{userId:'201711271733404C9DA1461F2421F828'}",dataType = "String", paramType = "body")
//    public void getForGroupByUserId(HttpServletResponse response, @RequestBody String jsonData) {
//        List<JSONObject> jsonObjectList = this.personnelReportFacade.getForGroupByUserId(jsonData);
//        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(jsonObjectList));
//    }


    @ResponseBody
    @RequestMapping(value = "/getForCompanyByUserId.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "获取公司管理层人员",
            notes = "获取公司管理层人员 ",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{userId:'20171216203048A0A7E90A366470DBE0'}", dataType = "String", paramType = "body")
    public void getForCompanyByUserId(HttpServletResponse response, @RequestBody String jsonData) {
        List<JSONObject> records = this.personnelReportFacade.getForCompanyByUserId(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(records));
    }

    @ResponseBody
    @RequestMapping(value = "/getForCompanyByCompanyId.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "获取公司管理层人员",
            notes = "获取公司管理层人员 ",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{CompanyId:'2017121617474C0586950A72B2629E79'}", dataType = "String", paramType = "body")
    public void getForCompanyByCompanyId(HttpServletResponse response, @RequestBody String jsonData) {
        List<JSONObject> records = this.personnelReportFacade.getForCompanyByCompanyId(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(records));
    }

    @ResponseBody
    @RequestMapping(value = "/getSumUpForCompanyByUserId.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "统计公司管理层人员人数",
            notes = "统计公司管理层人员人数 ",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{userId:'20171216203048A0A7E90A366470DBE0'}", dataType = "String", paramType = "body")
    public void getSumUpForCompanyByUserId(HttpServletResponse response, @RequestBody String jsonData) {
        List<JSONObject> records = this.personnelReportFacade.getSumUpForCompanyByUserId(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(records));
    }

    @RequestMapping(value = "/getSumUpForCompanyEntryByUserId.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "统计公司今日入职人数",
            notes = "统计公司今日入职人数 ",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{userId:'20171216203048A0A7E90A366470DBE0',dateTime:'2018-04-19'}", dataType = "String", paramType = "body")
    public void getSumUpForCompanyEntryByUserId(HttpServletResponse response, @RequestBody String jsonData){
        List<JSONObject> records = this.personnelReportFacade.getSumUpForCompanyEntryByUserId(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(records));
    }

    @RequestMapping(value = "/getSumUpForCompanyLeaveByUserId.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "统计公司今日离职人数",
            notes = "统计公司今日离职人数 ",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{userId:'20171216203048A0A7E90A366470DBE0',dateTime:'2018-04-19'}", dataType = "String", paramType = "body")
    public void getSumUpForCompanyLeaveByUserId(HttpServletResponse response, @RequestBody String jsonData){
        List<JSONObject> records = this.personnelReportFacade.getSumUpForCompanyLeaveByUserId(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(records));
    }

    @ResponseBody
    @RequestMapping(value = "/getForGroupByUserId.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "获取集团人员",
            notes = "获取集团人员",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{userId:'2017121618514C22B68296F31AF8DDE2'}", dataType = "String", paramType = "body")
    public void getForGroupByUserId(HttpServletResponse response, @RequestBody String jsonData) {
        List<JSONObject> records = this.personnelReportFacade.getForGroupByUserId(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(records));
    }

    @ResponseBody
    @RequestMapping(value = "/getSumUpForGroupByUserId.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "统计集团人员人数",
            notes = "统计集团人员人数",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{userId:'2017121618514C22B68296F31AF8DDE2'}", dataType = "String", paramType = "body")
    public void getSumUpForGroupByUserId(HttpServletResponse response, @RequestBody String jsonData) {
        List<JSONObject> records = this.personnelReportFacade.getSumUpForGroupByUserId(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(records));
    }

    @ResponseBody
    @RequestMapping(value = "/getSumUpForGroupEntryByUserId.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "统计集团今日入职人数",
            notes = "统计集团今日入职人数 ",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{userId:'2017121618514C22B68296F31AF8DDE2',dateTime:'2018-04-19'}", dataType = "String", paramType = "body")
    public void getSumUpForGroupEntryByUserId(HttpServletResponse response, @RequestBody String jsonData) {
        List<JSONObject> records = this.personnelReportFacade.getSumUpForGroupEntryByUserId(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(records));
    }

    @ResponseBody
    @RequestMapping(value = "/getSumUpForGroupLeaveByUserId.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "统计集团今日离职人数",
            notes = "统计集团今日离职人数 ",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParam(name = "jsonData", value = "{userId:'2017121618514C22B68296F31AF8DDE2',dateTime:'2018-04-19'}", dataType = "String", paramType = "body")
    public void getSumUpForGroupLeaveByUserId(HttpServletResponse response, @RequestBody String jsonData) {
        List<JSONObject> records = this.personnelReportFacade.getSumUpForGroupLeaveByUserId(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(records));
    }

}
